import request from '@/utils/request'

// 居民人均收支项
export function getIncomeExpeseItems() {
  return request({
    url: '/calculator/item/',
    method: 'GET'

  })
}

export function addIncomeExpeseItem(itemInfo) {
  return request({
    url: '/calculator/item/',
    method: 'POST',
    data: itemInfo
  })
}

export function updateIncomeExpeseItem(itemInfo) {
  return request({
    url: `/calculator/item/${itemInfo.id}/`,
    method: 'PATCH',
    data: itemInfo
  })
}

export function delIncomeExpeseItem(item_id) {
  return request({
    url: `/calculator/item/${item_id}/`,
    method: 'DELETE',
  })
}
// 行业管理
export function getIndustries() {
  return request({
    url: '/calculator/industry/',
    method: 'GET'
  })
}


export function addIndustry(industInfo) {
  return request({
    url: '/calculator/industry/',
    method: 'POST',
    data: industInfo
  })
}

export function updateIndustry(industInfo) {
  return request({
    url: `/calculator/industry/${industInfo.id}/`,
    method: 'PATCH',
    data: industInfo
  })
}

export function delIndustry(indust_id) {
  return request({
    url: `/calculator/industry/${indust_id}/`,
    method: 'DELETE',
  })
}

// 行业城镇单位在岗职工平均工资
export function getIndustWage(query) {
  return request({
    url: '/calculator/indust_wage/',
    method: 'GET',
    params: query
  })
}

export function addIndustWage(wageInfo) {
  return request({
    url: '/calculator/indust_wage/',
    method: 'POST',
    data: wageInfo
  })
}

export function updateIndustWage(wageInfo) {
  return request({
    url: `/calculator/indust_wage/${wageInfo.id}/`,
    method: 'PATCH',
    data: wageInfo
  })
}

export function delIndustWage(wage_id) {
  return request({
    url: `/calculator/indust_wage/${wage_id}/`,
    method: 'DELETE',
  })
}

// 居民人均收支情况表
export function getResIncomeExpense(query) {
  return request({
    url: '/calculator/res_income_expend/',
    method: 'GET',
    params: query
  })
}

export function addResIncomeExpense(resInfo) {
  return request({
    url: '/calculator/res_income_expend/',
    method: 'POST',
    data: resInfo
  })
}

export function updateResIncomeExpense(resInfo) {
  return request({
    url: `/calculator/res_income_expend/${resInfo.id}/`,
    method: 'PATCH',
    data: resInfo
  })
}

export function delResIncomeExpense(res_id) {
  return request({
    url: `/calculator/res_income_expend/${res_id}/`,
    method: 'DELETE',
  })
}

export function getProvinceList(){
  return request({
    url: '/calculator/province_list/',
    method: 'GET'
  })
}